package data

import (
	"context"
	"demo01/internal/biz"
	"fmt"
	"github.com/go-kratos/kratos/v2/log"
)

type demoRepo struct {
	data *Data
	log  *log.Helper
}

func NewDemoRepo(data *Data, logger log.Logger) biz.DemoRepo {
	return &demoRepo{data: data, log: log.NewHelper(logger)}
}

func (d *demoRepo) Save(ctx context.Context, demo *biz.Demo) (*biz.Demo, error) {
	po, err := d.data.db.User.Create().SetName("张三").SetAge(18).Save(ctx)
	fmt.Println(po)
	if err != nil {
		return nil, err
	}
	return demo, nil
}
func (d *demoRepo) Update(ctx context.Context, demo *biz.Demo) (*biz.Demo, error) {
	return nil, nil
}
func (d *demoRepo) FindByID(ctx context.Context, id int64) (*biz.Demo, error) {
	return nil, nil
}
func (d *demoRepo) ListByHello(ctx context.Context, h string) ([]*biz.Demo, error) {
	return nil, nil
}
func (d *demoRepo) ListAll(ctx context.Context) ([]*biz.Demo, error) {
	return nil, nil
}
